@extends('admin.header')
@section('title','直播录播管理')
@section('content')
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="col-md-12" id="content">
            <div class="app_content_div" id="app_content_div_301Index">
                <h3>列表</h3>
            </div>
            <div>
                <div style="float:right;">
                    <a href="/video/list-create" type="button" class="btn btn-primary">新增视频</a>
                </div>
            </div>
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>id</th>
                    <th>标题</th>
                    <th>科室</th>
                    <th>专家</th>
                    <th>类型</th>
                    <th>直播开始时间</th>
                    <th>直播结束时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                @foreach($video as $v)
                    <tbody>
                    <tr>
                        <th scope="row">{{$v->id}}</th>
                        <td>{{$v->title}}</td>
                        @if(isset($v->connection[0]))
                            <td>{{$v->connection[0]->department}}</td>
                            <td>{{$v->connection[0]->name}}</td>
                        @else
                            <td></td>
                            <td></td>
                        @endif
                        @if($v->type==1)
                            <td>直播</td>
                        @else
                            <td>录播</td>
                        @endif
                        <td>{{$v->begin}}</td>
                        <td>{{$v->end}}</td>
                        <td>
                            <a href="/video/list-edit/{{$v->id}}"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a> &nbsp;&nbsp;&nbsp;
                            <a onclick="delvideo('/video/list-delete/{{$v->id}}')" ><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>

                        </td>
                    </tr>
                    </tbody>
                @endforeach
            </table>
            <div class="center">{{$video->links('page2')}}</div>
        </div>
    </div>
    </div>
    </div>
    <script>
        function delvideo(url){
            if(confirm("确定要删除吗？")){
                location.href = url;
            }
        }
    </script>
    </body>

    </html>
@endsection
